// 获取当前位置的经纬度
export const getCurrentPosition = (): Promise<[number, number]> => {
    return new Promise((resolve, reject) => {
      if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(
          (position) => {
            const { longitude, latitude } = position.coords;
            resolve([longitude, latitude]);
          },
          (error) => {
            console.error("定位失败,将返回默认位置:", error.message);
            reject(error);
            // resolve([113.809225, 34.800263]); // 郑州坐标
          }
        );
      } else {
        reject(new Error("浏览器不支持地理定位"));
      }
    });
  };

